import difflib
s1 = "'chat': {'type': '闲聊', 'chat': '智能网联是一种汽车、电子、信息通信、道路交通运输等行业深度融合的新型产业形态，通过提升汽车网联化、智能化水平，实现自动驾驶和智能交通，促进信息消费。它的发展有利于推进供给侧结构性改革、推动制造强国和网络强国建设，对我国实现高质量发展具有重要意义。'}"
s2 = "'chat': {'type': '闲聊', 'chat': '智能网联是一种汽车、电子、信息通信、道路交通运输等行业深度融合的新型产业形态，通过提升汽车网联化、智能化水平，实现自动驾驶和智能交通，促进信息消费。它的发展有利于推进供给侧结构性改革、推动制造强国和网络强国建设，对我国实现高质量发展具有重要意义。'}"

s = difflib.SequenceMatcher(None, s1, s2)
res = ""
for tag, i1, i2, j1, j2 in s.get_opcodes():
    if tag == "equal":
        res += s1[i1:i2]
print(res)


m = "qead"
n = "123432"
j = ''
if m.isdigit():
    print('m是数字开头')

if n.isdigit():
    print('n是数字开头')
if j.isdigit():
    print('j是数字开头')


q = "qewacfs"
if q.find('cda') != -1:
    print(q)


from difflib import Differ
str1 = "I would like to order a pepperoni pizza.\n And you?"
str2 = "I would like to order a veggie burger.\n And you?"
str1_lines = str1.splitlines()
str2_lines = str2.splitlines()
d = difflib.Differ()
diff = d.compare(str1_lines, str2_lines)
for lines in diff:
    print(lines)

from collections import Counter

str1 = "I would like to order a pepperoni pizza. And you?"

str2 = "I would like to order a veggie burger. And you?"

c1 = Counter(str1)

c2 = Counter(str2)

same = list((c1 & c2).elements())

print("两个字符串中相同的字符有：", same)


s1 = "关闭一下路测感知事件取证视频"
s2 = "关闭一下路侧港之事件取证视频"
set1 = set(s1)
set2 = set(s2)
res = set1.intersection(set2)
s3 = ''.join(res)
print(res)
print(s3)


# 对比两个字符串的差异
s1 = "帮我关闭一下路测感知事件取证视频"
s2 = "帮我关闭一下路侧港芝事件取证视频"
s = difflib.SequenceMatcher(None, s1, s2)
res = ""
for tag, i1, i2, j1, j2 in s.get_opcodes():
    if tag == "equal":
        res += s1[i1:i2]
print(res)
l1 = []
for m1 in s2:
    if m1 not in res:
        l1.append(m1)
print(len(l1),l1)
l2 = []
for m1 in s1:
    if m1 not in res:
        l2.append(m1)
print(len(l2),l2)


import matplotlib.pyplot as plt

# 散点图分布1：假设房价和房屋面积的数据分别存储在price和area两个列表中

price = [100, 120, 150, 180, 200]
area = [80, 100, 120, 150, 180]

# 绘制散点图
plt.scatter(area, price)

# 设置横轴和纵轴标签
plt.xlabel('area')
plt.ylabel('price')

# 显示图形
plt.show()


# SHIJIANCHUO
from datetime import datetime

# 定义日期字符串
date_string = '2023/11/7 10:53:19'

# 将日期字符串转换为datetime对象
dt = datetime.strptime(date_string, '%Y/%m/%d %H:%M:%S')

# 将datetime对象转换为时间戳
timestamp = int(dt.timestamp())

print(timestamp)